<?php
	class chudedb
	{
		public function Add($TenChuDe)
		{
			$sql = "INSERT INTO `tbl_chude`(`TenChuDe`) VALUES ('$TenChuDe')";
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
		
		public function Delete($MaChuDe)
		{
			$sql = "DELETE FROM `tbl_chude` WHERE MaChuDe = $MaChuDe";
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
		
		public function Update($MaChuDe, $TenChuDe)
		{
			$sql = "UPDATE `tbl_chude` SET `TenChuDe`= '$TenChuDe' WHERE `MaChuDe`= $MaChuDe";
			$data = new dataservice();
			return $data->ExecuteNonQuery($sql);
		}
		
		public function GetList($MaChuDe, $TenChuDe)
		{
			$sql = "SELECT * FROM `tbl_chude` WHERE 1";
			if ($MaChuDe != 0)
				$sql .= " AND MaChuDe = $MaChuDe";
			if ($TenChuDe != "")
				$sql .= " AND TenChuDe = '$TenChuDe'";
			$data = new dataservice();
			return $data->ExecuteQuery($sql);
		}
	}
?>